<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <?
function generateSelect($name = '', $options = array()) {
	$html = '<select name="'.$name.'">';
	foreach ($options as $option => $value) {
		$html .= '<option value='.$value.'>'.$option.'</option>';
	}
	$html .= '</select>';
 	return $html;
}
?>
</head>
<body>
<?php
		
    /*session_start();
		
    ob_start();*/
	
    $data=$_GET["q"];
    $sprop=$_GET["prop"];
    $skab=$_GET["kab"];
    include('class.mysql.php');
    $mydb = new mysql();
    $connection = $mydb->Connect();
    $sql="select distinct lower(kecamatan) from identitas where mid(no_reg,1,2)='$sprop' and mid(no_reg,4,2)='$skab'";
    //echo "$sql";	
    $query = $mydb->Query($sql);
    $num = $mydb->FetchNum($query);
    $kecamatan[]="Pilih kecamatan";
    $kode[]="XX";
    //$kabupaten[]="Pilih kota2";
    while($array= mysql_fetch_row($query))
    {
        $kecamatan[]=$array[0];
    }
    //echo $data.$kabupaten[2];
    //ob_end_flush();

    $stTemp = '<select name="combo_kecamatan" onchange="tampil_kecamatan(this.value)">';
    $i=0;
    while($kecamatan[$i]!='')
    {
        $kecawal=strtoupper(substr($kecamatan[$i],0,1));
        $kecsisa=strtolower(substr($kecamatan[$i],1,20));
        $kecamatan[$i]=$kecawal.$kecsisa;
        if($i>0)
            $stTemp .= '<option value="'.$kecamatan[$i].'">'.$kecamatan[$i].'</option>';
        else
            $stTemp .= '<option value="">'.$kecamatan[$i].'</option>';
        $i++;
    }
    $stTemp .= '</select>';
    echo    $stTemp;

?>
</body>

